from django.db import models
from django.contrib.auth.models import AbstractUser

# Create your models here.


class User(AbstractUser):
    avatar = models.FileField(upload_to='avatar', default='static/img/user.png')
    birthday = models.DateField()
    city = models.CharField(max_length=16)
    telephone = models.BigIntegerField(default=11)


class Job(models.Model):
    id = models.AutoField(primary_key=True)
    title = models.CharField(max_length=32)
    salary = models.CharField(max_length=16)
    url = models.CharField(max_length=64)
    job_city = models.CharField(max_length=16)
    job_detail = models.OneToOneField(to='Job_detail', db_constraint=False)


class Job_detail(models.Model):
    id = models.AutoField(primary_key=True)
    job_years = models.CharField(max_length=16)
    degree_need = models.CharField(max_length=16)
    job_type = models.CharField(max_length=16)
    job_benefit = models.TextField()
    publish_time = models.CharField(max_length=32)
    job_address = models.CharField(max_length=64)
    job_publisher = models.CharField(max_length=32)
    job_desc = models.OneToOneField(to='Job_desc', null=True, on_delete=models.SET_NULL, db_constraint=False)


class Job_desc(models.Model):
    id = models.AutoField(primary_key=True)
    job_duty = models.TextField()
    job_requirement = models.TextField()